<template>
    <div>
        <table>
            <tr>
                <td>编号</td>
                <td>职责</td>
                <td>姓名</td>
            </tr>

            <tr v-for="item in books" :key="item.id">
                <td>{{item.userId}}</td>
                <td>{{item.userName}}</td>
                <td>{{item.userCode}}</td>
            </tr>
        </table>
    </div>
</template>

<script>
    export default {
        name: "Book",
        data(){
            return{
                msg:"Hello Vue",
                books:[
                    {
                        userId: 1,
                        userName: '村长',
                        userCode: '刘名超'
                },
                    {
                        userId: 2,
                        userName: '村委会',
                        userCode: '王兆明'
                    },
                    {
                        userId: 3,
                        userName: '局长',
                        userCode: '郭年锋'
                    }
                ]
            }
        },
        created:function () {
            const _this = this
            this.$axios.get(this.HPSY + '/user/findAll').then(function (resp) {
                _this.books = resp.data
            })
        }
    }
</script>

<style scoped>

</style>